package strategies

import (
	"ctpredis"
	"inisys"
	"os"
	"strconv"
	"strings"

	"github.com/sirupsen/logrus"
)

var (
	Rdb *ctpredis.StraRedis
)

func init() {
	inisys.InitHuaLian()
	tmp := ""
	if tmp = os.Getenv("RedisAddr"); tmp == "" {
		logrus.Fatal("未配置环境变量: RedisAddr")
	}
	RedisAddr := tmp

	if tmp = os.Getenv("RedisAuth"); tmp == "" {
		logrus.Fatal("未配置环境变量: RedisAuth")
	}
	RedisAuth := tmp
	tt := strings.Split(RedisAddr, ":")
	Host := tt[0]
	Rport, _ := strconv.Atoi(tt[1])
	Rdb, _ = ctpredis.NewStraRedis(Host, RedisAuth, Rport)

}
